import QtQuick 2.7
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.0


Rectangle {
    radius: 5
    RowLayout {
        id: rowLayout
        anchors.fill: parent
        Text {
            text: qsTr(libname) +
                  qsTr("库室门开启") +
                  (result==0 ?qsTr("成功"): qsTr("失败"))
            font.pixelSize: 20
            Layout.preferredWidth: 300
        }
        Text {
            id: time
            text:  Qt.formatDateTime(auth_time, "yyyy-MM-dd hh:mm")
            font.pixelSize: 20
            Layout.alignment: Qt.AlignRight
        }


    }
    MouseArea {
        id: mouseArea
        anchors.fill: parent
        onClicked: {
            open_popup.open()
        }


    }
    Popup {
        id: open_popup
        height: 220
        width: 400
        padding: 0
        anchors.centerIn: Overlay.overlay
        Rectangle {
            id: open_header
            width: parent.width
            height: 64
            color: "green"
            Text {
                text: qsTr("开门信息")
                font.pixelSize: 20
                anchors {
                    verticalCenter: parent.verticalCenter
                    leftMargin: 20
                    left: parent.left
                }
            }
            Button {
                anchors {
                    verticalCenter: parent.verticalCenter
                    rightMargin: 10
                    right: parent.right
                }
                background: Item {

                }
                icon {
                    source: "qrc:/images/close_face.png"
                }
                onClicked: {
                    open_popup.close()
                }
            }


        }
        ColumnLayout {
            anchors.top: open_header.bottom
            width: parent.width
            anchors.bottom: parent.bottom
            Text {
                Layout.leftMargin: 20
                Layout.topMargin: 20
                text: libname
            }
            Text {
                text: qsTr("授权人：") + auth_man
                Layout.leftMargin: 20
            }
            Text {
                text: qsTr("开门结果：") + result
                Layout.leftMargin: 20

            }
            Text {
                text: qsTr("授权时间：") + Qt.formatDateTime(auth_time, "yyyy-MM-dd hh:mm");
                Layout.leftMargin: 20
                Layout.bottomMargin: 20
            }

        }

    }

}
